package zsc.ruanc.practicaltraining.model.result;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 返回的json对象
 * @param <T>
 */
@AllArgsConstructor
@Getter
public class JsonResult<T> {

    private Integer code; // 响应码

    private String msg; // 信息

    private String info; // 具体信息

    private boolean flag; // 操作是否成功的标志位

    private T data; // 数据

    public JsonResult(ResultCode resultCode, T data, boolean flag) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
        this.data = data;
        this.flag = flag;
    }

    public JsonResult(ResultCode resultCode, boolean flag) {
        this.code = resultCode.getCode();
        this.msg = resultCode.getMsg();
        this.flag = flag;
    }

    public void setData(T data) {
        this.data = data;
    }

    public void setInfo(String info) {
        this.info = info;
    }


}
